import { BasicColumn, FormSchema } from '@apps/antd-admin/src/components/Table';
import { airportList } from '@apps/ant-bus/src/views/business/airport/data/api';
import { RenderType } from '@pkg/setting';

export const columns: BasicColumn[] = [
  {
    title: '申请时间',
    dataIndex: 'createTime',
    width: 150,
  },
  {
    title: '申请状态',
    dataIndex: 'invoiceState',
    width: 100,
    dictData: [
      { label: '已提交', value: 0, color: '#585b58' },
      { label: '已开票', value: 1, color: '#09f137' },
      { label: '已作废', value: 2, color: '#f60606' },
    ],
    renderType: RenderType.DICT,
  },
  {
    title: '会员姓名',
    dataIndex: 'userName',
    width: 120,
  },
  {
    title: '手机号',
    dataIndex: 'mobile',
    width: 120,
  },
  {
    title: '卡号',
    dataIndex: 'vipCardNo',
    width: 150,
  },
  {
    title: '收款方式',
    dataIndex: 'paywayName',
    width: 160,
  },
  {
    title: '金额',
    dataIndex: 'payAmount',
    width: 120,
  },
  {
    title: '开卡地区',
    dataIndex: 'airportName',
    width: 170,
  },
  {
    title: '销售姓名',
    dataIndex: 'employeeName',
    width: 120,
  },
  {
    title: '开卡日期',
    dataIndex: 'openDate',
    width: 140,
  },
  {
    title: '开票公司全称',
    dataIndex: 'invoiceCompanyInfo',
    align: 'left',
    width: 200,
  },
  {
    title: '发票备注',
    dataIndex: 'invoiceRemark',
    align: 'left',
    width: 500,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'startDate',
    label: '开始日期',
    component: 'DatePicker',
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      format: 'YYYY-MM-DD',
    },
  },
  {
    field: 'endDate',
    label: '结束日期',
    component: 'DatePicker',
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      format: 'YYYY-MM-DD',
    },
  },
  {
    field: 'userName',
    label: '姓名',
    component: 'Input',
  },
  {
    field: 'mobile',
    label: '手机号',
    component: 'Input',
  },
  {
    field: 'vipCardNo',
    label: '会员卡号',
    component: 'Input',
  },
  {
    field: 'airportId',
    label: '开卡地',
    component: 'ApiSelect',
    componentProps: {
      api: airportList,
      params: { handlerName: 'busAirportRoleListHandler' },
      labelField: 'airportName',
      valueField: 'airportId',
      showSearch: true,
      immediate: true,
    },
  },
  {
    field: 'invoiceState',
    label: '开票状态',
    component: 'Select',
    componentProps: {
      options: [
        { label: '已提交', value: 0 },
        { label: '已开票', value: 1 },
        { label: '已作废', value: 2 },
      ],
    },
  },
];
